<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="bean.Rectangle"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>使用各个作用域的Bean计算矩形面积和周长</title>
<style type="text/css">
body {
	font-family: 微软雅黑;
}
</style>
</head>
<body>
	<h4>转发、重定向和直接计算的情形</h4>
	<fieldset>
		<legend>page范围的JavaBean</legend>
		<jsp:useBean id="rectangle" class="bean.Rectangle" scope="page"></jsp:useBean>
		长：<jsp:getProperty property="length" name="rectangle" /><br />
		宽：<jsp:getProperty property="width" name="rectangle" /><br /> 
		面积：<%=rectangle.calculateArea()%><br /> 
		周长：<%=rectangle.calculatePerimeter()%>
	</fieldset>

	<fieldset>
		<legend>request范围的JavaBean</legend>
		<jsp:useBean id="rectangle2" class="bean.Rectangle" scope="request"></jsp:useBean>
		长：<jsp:getProperty property="length" name="rectangle2" /><br /> 
		宽：<jsp:getProperty property="width" name="rectangle2" /><br /> 
		面积：<%=rectangle2.calculateArea()%><br /> 
		周长：<%=rectangle2.calculatePerimeter()%>
	</fieldset>

	<fieldset>
		<legend>session范围的JavaBean</legend>
		<jsp:useBean id="rectangle3" class="bean.Rectangle" scope="session"></jsp:useBean>
		长：<jsp:getProperty property="length" name="rectangle3" /><br /> 
		宽：<jsp:getProperty property="width" name="rectangle3" /><br /> 
		面积：<%=rectangle3.calculateArea()%><br /> 
		周长：<%=rectangle3.calculatePerimeter()%>
	</fieldset>

	<fieldset>
		<legend>application范围的JavaBean</legend>
		<jsp:useBean id="rectangle4" class="bean.Rectangle" scope="application"></jsp:useBean>
		长：<jsp:getProperty property="length" name="rectangle4" /><br /> 
		宽：<jsp:getProperty property="width" name="rectangle4" /><br /> 
		面积：<%=rectangle4.calculateArea()%><br /> 
		周长：<%=rectangle4.calculatePerimeter()%>
	</fieldset>
</body>
</html>